package com.whopxx.exception;

import com.whopxx.enums.BizCodeEnum;
import lombok.Data;

@Data
public class BizException extends RuntimeException{
    private Integer code;
    private String msg;

    public static BizException of(Integer code, String msg) {
        BizException bizException = new BizException();
        bizException.setCode(code);
        bizException.setMsg(msg);
        return bizException;
    }

    public static BizException of(String msg) {
        BizException bizException = new BizException();
        bizException.setCode(BizCodeEnum.UNKNOWN_EXCEPTION.getCode());
        bizException.setMsg(msg);
        return bizException;
    }
}
